<?php

$player = $game->player_get_uinfo();
$tishi = '';
$fanye = "";
if (isset($arr_data->canshu)){
    if ($arr_data->canshu=='maichu'){
        $mczb = $game->zb_get_info_player($arr_data->zbnowid);
        $sxzz = $mczb->zbgj + $mczb->zbfy + $mczb->zbbj * 5 + $mczb->zbxx * 5 + $mczb->qianghua*3;
        $mcls = round($sxzz);
        $mcret = $game->zb_sell_yxb($arr_data->zbnowid ,$mcls);
        var_dump($mcret);

        if ($mcret){
            $ret = $game->yxb_change(1,$sxzz/2);
            $tishi = "卖出$mczb->zbname 成功，获得灵石:$mcls<br/>";
        }
    }
}
if ( !isset($yeshu) ){
    $yeshu = 1;

}

if (!isset($arr_data->cmd2)){
    $arr_data->cmd2 = "bagzb";
}

switch ($arr_data->cmd2 ){
    case 'delezb':
        $zhuangbei = $game->zb_get_info_player($arr_data->zbnowid);
        $fjls = $zhuangbei->qianghua * 20 + 20;
        $ret = $game->yxb_change(2 , $fjls);
        if ($ret){
            $game->zb_delete($arr_data->zbnowid);
            $qhs = round($zhuangbei->qianghua*$zhuangbei->qianghua);
            $sjs = mt_rand(1,100);
            if ($sjs <= 30){
                $sjs = mt_rand(1,100);
                if ($sjs>90){
                    $qhs = $qhs + 3;
                }elseif($sjs>80){
                    $qhs = $qhs + 2;
                }elseif ($sjs>70){
                    $qhs = $qhs + 1;
                }
            }
            $game->dj_add(1,$qhs);
            $tishi = '分解成功!<br/>';
            if ($qhs > 0){
                $tishi .= "获得强化石:".$qhs."!<br/>";
            }
        }else{
            $tishi = "灵石不足!<br/>";
        }
        break;

}




$zbcount = $game->zb_get_num();//装备数量
$zbhtml = '';

if ($yeshu != 1){
    $ye = $yeshu - 1;
    $shangyiye = $game->create_url("cmd=bagzb&cmd2=bagzb&yeshu=$ye","上一页");
    $fanye = $shangyiye;
}

if ($yeshu * 10 < $zbcount){
    $ye =$yeshu+1;
    $xiayiye = $game->create_url("cmd=bagzb&cmd2=bagzb&yeshu=$ye","下一页");
    $fanye .= $xiayiye;
}
if ( isset($fanye) ){
    $fanye = "<br/>$fanye<br/>";
}else{
    $fanye = '';
}
$hangshu = 0;

$retzb = $game->zb_get_ye($yeshu , 10);

for ( $i = 0; $i < count($retzb); $i++){
    $zbnowid = $retzb[$i]['zbnowid'];
    $arr = array($player->tool1,$player->tool2,$player->tool3,$player->tool4,$player->tool5,$player->tool6);
    $hangshu = $hangshu + 1;

    $zbname = $retzb[$i]['zbname'];
    $zbnowid = $retzb[$i]['zbnowid'];
    $zbqh = $retzb[$i]['qianghua'];
    $qhhtml = '';
    if($zbqh>0){
        $qhhtml="+".$zbqh;
    }
    $chakanzb = $game->create_url("cmd=zbinfo&cmd2=zbinfo&zbnowid=$zbnowid&uid=$player->uid","{$zbname}{$qhhtml}");
    if (!in_array($zbnowid,$arr)){
        $mczb = $game->create_url("cmd=bagzb&cmd2=bagzb&canshu=maichu&yeshu=$yeshu&zbnowid=$zbnowid","卖出");
        $delezb = $game->create_url("cmd=bagzb&cmd2=delezb&zbnowid=$zbnowid","分解");
        $zbhtml .= "[$hangshu]{$chakanzb}{$mczb}{$delezb}<br/>";
    }else{
        $zbhtml .= "[$hangshu].$chakanzb(已装备)<br/>";
    }
}

$变量_装备列表 = (object)array(
    "装备列表"=>$zbhtml,
    "链接_翻页"=>$fanye,
    "提示信息"=>$tishi
);

$dis_mid = $game->dis_get('排版_装备列表');
eval("\$out_html = \"$dis_mid->dis_string\";");
$out_html = str_replace("<br/><br/>", "<br/>",$out_html);
$out_html = str_replace("<br/><br/>", "<br/>",$out_html);
$out_html = str_replace("</div><br/>", "</div>",$out_html);
echo $out_html;

